import 'package:flutter/material.dart';
import 'package:ost_flutter_module/common/adapt.dart';
import 'package:ost_flutter_module/common/color.dart';

void showLoadingDialog(BuildContext context, {String loadingText = "加载中..."}) {
  showDialog(
      context: context,
      barrierDismissible: false,
      builder: (context) {
        return SimpleDialog(
          shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(Adapt.px(5))),
          backgroundColor: colorA6000000,
          elevation: 0.0,
          children: <Widget>[
            Column(
              children: <Widget>[
                SizedBox(height: 20.0),
                SizedBox(
                  width: Adapt.px(25),
                  height: Adapt.px(25),
                  child: CircularProgressIndicator(
                    valueColor: AlwaysStoppedAnimation<Color>(primaryColor),
                    strokeWidth: Adapt.px(2),
                  ),
                ),
                SizedBox(height: Adapt.px(16)),
                Text(
                  loadingText,
                  style: TextStyle(color: Colors.white, fontSize: Adapt.px(14)),
                ),
                SizedBox(height: 10.0),
              ],
            ),
          ],
        );
      });
}
